/**
 * 
 */
package pl.kkalisz.android.model.item.modules;

import java.util.ArrayList;
import java.util.List;

import pl.kkalisz.android.model.item.interfaces.uActionItemInterface;
import pl.kkalisz.android.model.item.interfaces.uOnClickedListner;

/**
 * @author kkalisz
 *
 */
public class uListenerModule{
    
    List<uOnClickedListner> mListeners = new ArrayList<uOnClickedListner>();
    
    /**
     * @param BngOnActionListner - add on click lister for this item
     */
    public void addClickedListner(uOnClickedListner aListener)
    {
        mListeners.add(aListener);
    }
    
    /**
     * @return true if Listener was attached and removed
     */
    public boolean removerActionListener(uOnClickedListner aListener)
    {
        return mListeners.remove(aListener);
    }
    
    
    /**
     *  remove all listeners attached to this view
     */
    public void removeAllListeners()
    {
        mListeners.clear();
    }
    
    public void fire(uActionItemInterface aItem)
    {
        for(uOnClickedListner lis: mListeners)
        {
            lis.onClick(aItem);
        }
    }
    

}
